﻿<%@ Page Language="C#" MasterPageFile="~/admin/Admin.Master" AutoEventWireup="true"
    Codebehind="groupAE.aspx.cs" Inherits="CMS.admin.groupAE" Title="Hệ thống quản trị nội dung - Quản lý nhóm người dùng" %>

<%@ Register Assembly="ComponentArt.Web.UI" Namespace="ComponentArt.Web.UI" TagPrefix="ComponentArt" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <link href="../css/treeStyle.css" type="text/css" rel="stylesheet" />

    <script type="text/javascript">
    function TreeView1_onNodeCheckChange(sender, eventArgs)
    {
     var rootNode = eventArgs.get_node();
     var status = rootNode.get_checked();
     //rootNode.checkAll();
    OnSubNodeCheckChange(rootNode,status);
    }
    function OnSubNodeCheckChange(SubNode,IsChecked) 
    {
        var ChildNodes = SubNode.get_nodes();
     
        for (var i = 0; i < ChildNodes.get_length(); i++)
        {
          if (IsChecked)
            ChildNodes.getNode(i).set_checked(true);
          else
            ChildNodes.getNode(i).set_checked(false);
          //OnSubNodeCheckChange(ChildNodes.getNode(i),IsChecked);
          var ChildNodes2= ChildNodes.getNode(i).get_nodes();
            for (var j = 0; j < ChildNodes2.get_length(); j++)
            {
              if (IsChecked)
                ChildNodes2.getNode(j).set_checked(true);
              else
                ChildNodes2.getNode(j).set_checked(false);
            }
        }
    }
    function TreeView2_onNodeCheckChange(sender, eventArgs)
    {
        var rootNode = eventArgs.get_node();
        var status = rootNode.get_checked();
        //rootNode.checkAll();
        OnSubNodeCheckChange(rootNode,status);
    }
    </script>

    <div style="border: solid 1px #ccc;">
        <div id="toolbox">
            <div class="header" style="float: left; margin-left: -40px;">
                <img src="../images/Toolbox/icon-48-user.png" alt="" id="imgHeader" />
                Quản lý nhóm người dùng: thêm/sửa
            </div>
            <div style="float: right;">
                <table class="toolbar">
                    <tr>
                        <td align="center">
                            <asp:LinkButton ID="btnUpdate" runat="server" OnClick="btnUpdate_Click">
                                <asp:Label ID="Label1" CssClass="Icon-32-Save" runat="server" />
                                Cập nhật
                            </asp:LinkButton>
                        </td>
                        <td align="center">
                            <asp:LinkButton ID="btnClose" CausesValidation="false" runat="server" OnClick="btnClose_Click">
                                <asp:Label ID="Label4" CssClass="Icon-32-Cancel" runat="server" />
                                Đóng lại
                            </asp:LinkButton>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    <p align="center">
        <br />
        <asp:Label ID="lblMessage" runat="server" BackColor="White" BorderColor="White" ForeColor="Red"></asp:Label>
    </p>
    <div id="content-box">
        <div class="t">
            <div class="t">
                <div class="t">
                </div>
            </div>
        </div>
        <div class="m" >
            <!--table2:data form-->
            <table width="830" cellpadding="5" border="0" cellspacing="5">
                <tr>
                    <td align="right" style="width: 100px">
                        <asp:Label ID="lblGroupName" runat="server" Text="Tên nhóm:"></asp:Label>
                    </td>
                    <td style="text-align: left">
                        <asp:TextBox ID="txtGroupName" runat="Server" Width="200px"></asp:TextBox><font color="#ff0000">
                            *</font>&nbsp;&nbsp;
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtDescription"
                            ErrorMessage="Trường bắt buộc nhập liệu" InitialValue="0"></asp:RequiredFieldValidator>
                    </td>
                    <td >
                        <asp:Label ID="lblStatus" runat="server" Text="Trạng thái:"></asp:Label>
                    </td>
                    <td style="text-align: left">
                        <asp:RadioButton ID="rdActive" runat="server" Checked="true" GroupName="rdgTrangThai"
                            Text="Hoạt động" />
                        <asp:RadioButton ID="rdInActive" runat="server" GroupName="rdgTrangThai" Text="Không hoạt động" />
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 100px" valign="top">
                        <asp:Label ID="lblDecription" runat="server" Text="Mô tả:"></asp:Label>
                    </td>
                    <td style="text-align: left" colspan="3">
                        <asp:TextBox ID="txtDescription" runat="Server" TextMode="MultiLine" Width="300px"
                            Height="70px"></asp:TextBox>
                        <font color="#ff0000">*</font>&nbsp;&nbsp;
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtDescription"
                            ErrorMessage="Trường bắt buộc nhập liệu" InitialValue="0"></asp:RequiredFieldValidator>
                    </td>
                </tr>
            </table>
            <!--end:table2-->
            <br />
            <table width="830" cellpadding="1" border="0" cellspacing="1">
                <tr>
                    <td align="right" style="width: 300px" valign="top">
                        <asp:Label ID="Label2" runat="server" Text="Gán các chức năng:"></asp:Label>
                    </td>
                    <td style="text-align: left">
                        <ComponentArt:TreeView ID="TreeView1"
                            CssClass="TreeView" NodeCssClass="TreeNode" SelectedNodeCssClass="SelectedTreeNode"
                            HoverNodeCssClass="HoverTreeNode" NodeEditCssClass="NodeEdit" LineImageWidth="19"
                            LineImageHeight="20" DefaultImageWidth="16" DefaultImageHeight="16" ItemSpacing="0"
                            NodeLabelPadding="3" LineImagesFolderUrl="../images/lines/" Height="450" Width="300"
                            ShowLines="true" runat="server">
                            <ClientEvents>
                                <NodeCheckChange EventHandler="TreeView1_onNodeCheckChange" />
                            </ClientEvents>
                        </ComponentArt:TreeView>
                    </td>
                    <td align="right" style="width: 300px" valign="top">
                        <asp:Label ID="Label3" runat="server" Text="Gán các danh mục:"></asp:Label>
                    </td>
                    <%--EnableViewState="false" Chu y bo cai nay di neu ko ko bat duoc checkbox--%>
                    <td style="text-align: left">
                        <ComponentArt:TreeView ID="TreeView2" 
                            CssClass="TreeView" NodeCssClass="TreeNode" SelectedNodeCssClass="SelectedTreeNode"
                            HoverNodeCssClass="HoverTreeNode" NodeEditCssClass="NodeEdit" LineImageWidth="19"
                            LineImageHeight="20" DefaultImageWidth="16" DefaultImageHeight="16" ItemSpacing="0"
                            NodeLabelPadding="3" LineImagesFolderUrl="../images/lines/" Height="450" Width="300"
                            ShowLines="true"  runat="server">
                            <ClientEvents>
                                <NodeCheckChange EventHandler="TreeView2_onNodeCheckChange" />
                            </ClientEvents>
                        </ComponentArt:TreeView>
                    </td>
                </tr>
            </table>
            <div class="clr">
            </div>
        </div>
        <div class="b">
            <div class="b">
                <div class="b">
                </div>
            </div>
        </div>
    </div>
</asp:Content>
